package com.yl.ydk.base

import com.yl.ydk.api.Api
import com.yl.ydk.bean.Base64UploadBean
import com.yl.ydk.bean.SendSmsCodeBean
import com.yl.ydk.bean.UserInfoBean
import okhttp3.MultipartBody
import rx.Subscription

class RequestUtils {

    fun getLogin(
        query: Array<out String?>,
        observer: BaseObserver<UserInfoBean>
    ): Subscription? {
        return Api.getInstance()?.getLogin(*query)?.compose(RxHelper.applySchedulers())
            ?.subscribe(observer)
    }

    fun getSendSmsCode(
        query: Array<out String?>,
        observer: BaseObserver<SendSmsCodeBean>
    ): Subscription? {
        return Api.getInstance()?.getSendSmsCode(*query)?.compose(RxHelper.applySchedulers())
            ?.subscribe(observer)
    }

    fun getBase64Upload(
        requestBody: MultipartBody,
        observer: BaseObserver<Base64UploadBean>
    ): Subscription? {
        return Api.getInstance()?.getBase64Upload(requestBody)?.compose(RxHelper.applySchedulers())
            ?.subscribe(observer)
    }

}

